package com.timesheet.gui.efforttracker.composite;

import com.timesheet.gui.efforttracker.controllers.EffortResultTableCompositeController;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.forms.widgets.FormToolkit;

public class NewEffortResultTableComposite extends Composite {

	private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());

	private Table table;

	private TableViewer tableViewer;

	private TableViewerColumn taskTypeColumn;

	private EffortResultTableCompositeController effortResultTableCompositeController;

	private TableViewerColumn taskStatus;

	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public NewEffortResultTableComposite(Composite parent, int style) {
		super(parent, style);
		setLayout(new GridLayout(1, false));

		tableViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
		table = tableViewer.getTable();
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
		gd_table.widthHint = 841;
		table.setLayoutData(gd_table);
		formToolkit.paintBordersFor(table);

		TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
		TableColumn tblclmnTasktype = tableViewerColumn.getColumn();
		tblclmnTasktype.setWidth(167);
		tblclmnTasktype.setText("Day");

		taskTypeColumn = new TableViewerColumn(tableViewer, SWT.NONE);
		TableColumn tblclmnTasktype_1 = taskTypeColumn.getColumn();
		tblclmnTasktype_1.setWidth(155);
		tblclmnTasktype_1.setText("Tasktype");

		TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewer, SWT.NONE);
		TableColumn tblclmnTaskno = tableViewerColumn_2.getColumn();
		tblclmnTaskno.setWidth(76);
		tblclmnTaskno.setText("Taskno");

		TableViewerColumn tableViewerColumn_4 = new TableViewerColumn(tableViewer, SWT.NONE);
		TableColumn tblclmnTaskphane = tableViewerColumn_4.getColumn();
		tblclmnTaskphane.setWidth(143);
		tblclmnTaskphane.setText("Taskphase");

		TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tableViewer, SWT.NONE);
		TableColumn tblclmnHours = tableViewerColumn_3.getColumn();
		tblclmnHours.setWidth(67);
		tblclmnHours.setText("Hours");

		taskStatus = new TableViewerColumn(tableViewer, SWT.NONE);
		TableColumn tbclStatus = taskStatus.getColumn();
		tbclStatus.setWidth(100);
		tbclStatus.setText("Status");

		TableViewerColumn tableViewerColumn_5 = new TableViewerColumn(tableViewer, SWT.NONE);
		TableColumn tbclDescription = tableViewerColumn_5.getColumn();
		tbclDescription.setWidth(209);
		tbclDescription.setText("Description");

		effortResultTableCompositeController = new EffortResultTableCompositeController(this);

	}

	public EffortResultTableCompositeController getEffortResultTableCompositeController() {
		return effortResultTableCompositeController;
	}

	@Override
	protected void checkSubclass() {

	}

	public TableViewer getTableViewer() {
		return tableViewer;
	}

	public TableViewerColumn getTaskTypeColumn() {
		return taskTypeColumn;
	}

	public TableViewerColumn getTaskStatusColumn() {
		return taskStatus;
	}

}
